3.3.11 \(\int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx\) [211]

3.3.11.1 Optimal result
3.3.11.2 Mathematica [C] (verified)
3.3.11.3 Rubi [A] (verified)
3.3.11.4 Maple [B] (verified)
3.3.11.5 Fricas [B] (verification not implemented)
3.3.11.6 Sympy [F]
3.3.11.7 Maxima [F]
3.3.11.8 Giac [B] (verification not implemented)
3.3.11.9 Mupad [F(-1)]

3.3.11.1 Optimal result

Integrand size = 17, antiderivative size = 85 \[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=-\frac {(a+2 b) \text {arctanh}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a+b \tanh ^2(x)}}\right )}{2 \sqrt {b}}+\sqrt {a+b} \text {arctanh}\left (\frac {\sqrt {a+b} \tanh (x)}{\sqrt {a+b \tanh ^2(x)}}\right )-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)} \]

output
-1/2*(a+2*b)*arctanh(b^(1/2)*tanh(x)/(a+b*tanh(x)^2)^(1/2))/b^(1/2)+arctan 
h((a+b)^(1/2)*tanh(x)/(a+b*tanh(x)^2)^(1/2))*(a+b)^(1/2)-1/2*(a+b*tanh(x)^ 
2)^(1/2)*tanh(x)
 
3.3.11.2 Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 4 vs. order 3 in optimal.

Time = 3.74 (sec) , antiderivative size = 193, normalized size of antiderivative = 2.27 \[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=\frac {\left (\sqrt {2} a \sqrt {\frac {(a-b+(a+b) \cosh (2 x)) \text {csch}^2(x)}{b}} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {\frac {(a-b+(a+b) \cosh (2 x)) \text {csch}^2(x)}{b}}}{\sqrt {2}}\right ),1\right )-2 \sqrt {2} a \sqrt {\frac {(a-b+(a+b) \cosh (2 x)) \text {csch}^2(x)}{b}} \operatorname {EllipticPi}\left (\frac {b}{a+b},\arcsin \left (\frac {\sqrt {\frac {(a-b+(a+b) \cosh (2 x)) \text {csch}^2(x)}{b}}}{\sqrt {2}}\right ),1\right )-(a-b+(a+b) \cosh (2 x)) \text {sech}^2(x)\right ) \tanh (x)}{2 \sqrt {2} \sqrt {(a-b+(a+b) \cosh (2 x)) \text {sech}^2(x)}} \]

input
Integrate[Tanh[x]^2*Sqrt[a + b*Tanh[x]^2],x]
 
output
((Sqrt[2]*a*Sqrt[((a - b + (a + b)*Cosh[2*x])*Csch[x]^2)/b]*EllipticF[ArcS 
in[Sqrt[((a - b + (a + b)*Cosh[2*x])*Csch[x]^2)/b]/Sqrt[2]], 1] - 2*Sqrt[2 
]*a*Sqrt[((a - b + (a + b)*Cosh[2*x])*Csch[x]^2)/b]*EllipticPi[b/(a + b), 
ArcSin[Sqrt[((a - b + (a + b)*Cosh[2*x])*Csch[x]^2)/b]/Sqrt[2]], 1] - (a - 
 b + (a + b)*Cosh[2*x])*Sech[x]^2)*Tanh[x])/(2*Sqrt[2]*Sqrt[(a - b + (a + 
b)*Cosh[2*x])*Sech[x]^2])
 
3.3.11.3 Rubi [A] (verified)

Time = 0.32 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.05, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.588, Rules used = {3042, 25, 4153, 25, 380, 398, 224, 219, 291, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int -\tan (i x)^2 \sqrt {a-b \tan (i x)^2}dx\)

\(\Big \downarrow \) 25

\(\displaystyle -\int \tan (i x)^2 \sqrt {a-b \tan (i x)^2}dx\)

\(\Big \downarrow \) 4153

\(\displaystyle -\int -\frac {\tanh ^2(x) \sqrt {b \tanh ^2(x)+a}}{1-\tanh ^2(x)}d\tanh (x)\)

\(\Big \downarrow \) 25

\(\displaystyle \int \frac {\tanh ^2(x) \sqrt {a+b \tanh ^2(x)}}{1-\tanh ^2(x)}d\tanh (x)\)

\(\Big \downarrow \) 380

\(\displaystyle \frac {1}{2} \int \frac {(a+2 b) \tanh ^2(x)+a}{\left (1-\tanh ^2(x)\right ) \sqrt {b \tanh ^2(x)+a}}d\tanh (x)-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)}\)

\(\Big \downarrow \) 398

\(\displaystyle \frac {1}{2} \left (2 (a+b) \int \frac {1}{\left (1-\tanh ^2(x)\right ) \sqrt {b \tanh ^2(x)+a}}d\tanh (x)-(a+2 b) \int \frac {1}{\sqrt {b \tanh ^2(x)+a}}d\tanh (x)\right )-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)}\)

\(\Big \downarrow \) 224

\(\displaystyle \frac {1}{2} \left (2 (a+b) \int \frac {1}{\left (1-\tanh ^2(x)\right ) \sqrt {b \tanh ^2(x)+a}}d\tanh (x)-(a+2 b) \int \frac {1}{1-\frac {b \tanh ^2(x)}{b \tanh ^2(x)+a}}d\frac {\tanh (x)}{\sqrt {b \tanh ^2(x)+a}}\right )-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {1}{2} \left (2 (a+b) \int \frac {1}{\left (1-\tanh ^2(x)\right ) \sqrt {b \tanh ^2(x)+a}}d\tanh (x)-\frac {(a+2 b) \text {arctanh}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a+b \tanh ^2(x)}}\right )}{\sqrt {b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)}\)

\(\Big \downarrow \) 291

\(\displaystyle \frac {1}{2} \left (2 (a+b) \int \frac {1}{1-\frac {(a+b) \tanh ^2(x)}{b \tanh ^2(x)+a}}d\frac {\tanh (x)}{\sqrt {b \tanh ^2(x)+a}}-\frac {(a+2 b) \text {arctanh}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a+b \tanh ^2(x)}}\right )}{\sqrt {b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {1}{2} \left (2 \sqrt {a+b} \text {arctanh}\left (\frac {\sqrt {a+b} \tanh (x)}{\sqrt {a+b \tanh ^2(x)}}\right )-\frac {(a+2 b) \text {arctanh}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a+b \tanh ^2(x)}}\right )}{\sqrt {b}}\right )-\frac {1}{2} \tanh (x) \sqrt {a+b \tanh ^2(x)}\)

input
Int[Tanh[x]^2*Sqrt[a + b*Tanh[x]^2],x]
 
output
(-(((a + 2*b)*ArcTanh[(Sqrt[b]*Tanh[x])/Sqrt[a + b*Tanh[x]^2]])/Sqrt[b]) + 
 2*Sqrt[a + b]*ArcTanh[(Sqrt[a + b]*Tanh[x])/Sqrt[a + b*Tanh[x]^2]])/2 - ( 
Tanh[x]*Sqrt[a + b*Tanh[x]^2])/2
 

3.3.11.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 224
Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], 
x, x/Sqrt[a + b*x^2]] /; FreeQ[{a, b}, x] &&  !GtQ[a, 0]
 

rule 291
Int[1/(Sqrt[(a_) + (b_.)*(x_)^2]*((c_) + (d_.)*(x_)^2)), x_Symbol] :> Subst 
[Int[1/(c - (b*c - a*d)*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a, b, c, 
d}, x] && NeQ[b*c - a*d, 0]
 

rule 380
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ 
), x_Symbol] :> Simp[e*(e*x)^(m - 1)*(a + b*x^2)^(p + 1)*((c + d*x^2)^q/(b* 
(m + 2*(p + q) + 1))), x] - Simp[e^2/(b*(m + 2*(p + q) + 1))   Int[(e*x)^(m 
 - 2)*(a + b*x^2)^p*(c + d*x^2)^(q - 1)*Simp[a*c*(m - 1) + (a*d*(m - 1) - 2 
*q*(b*c - a*d))*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c 
- a*d, 0] && GtQ[q, 0] && GtQ[m, 1] && IntBinomialQ[a, b, c, d, e, m, 2, p, 
 q, x]
 

rule 398
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*Sqrt[(c_) + (d_.)*(x_)^2]) 
, x_Symbol] :> Simp[f/b   Int[1/Sqrt[c + d*x^2], x], x] + Simp[(b*e - a*f)/ 
b   Int[1/((a + b*x^2)*Sqrt[c + d*x^2]), x], x] /; FreeQ[{a, b, c, d, e, f} 
, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4153
Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], 
 x]}, Simp[c*(ff/f)   Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2 + f 
f^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, 
n, p}, x] && (IGtQ[p, 0] || EqQ[n, 2] || EqQ[n, 4] || (IntegerQ[p] && Ratio 
nalQ[n]))
 
3.3.11.4 Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(275\) vs. \(2(67)=134\).

Time = 0.09 (sec) , antiderivative size = 276, normalized size of antiderivative = 3.25

method result size
derivativedivides \(-\frac {\sqrt {a +b \tanh \left (x \right )^{2}}\, \tanh \left (x \right )}{2}-\frac {a \ln \left (\sqrt {b}\, \tanh \left (x \right )+\sqrt {a +b \tanh \left (x \right )^{2}}\right )}{2 \sqrt {b}}+\frac {\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{2}-\frac {\sqrt {b}\, \ln \left (\frac {b \left (1+\tanh \left (x \right )\right )-b}{\sqrt {b}}+\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}\right )}{2}-\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b -2 b \left (1+\tanh \left (x \right )\right )+2 \sqrt {a +b}\, \sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{1+\tanh \left (x \right )}\right )}{2}-\frac {\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{2}-\frac {\sqrt {b}\, \ln \left (\frac {b \left (\tanh \left (x \right )-1\right )+b}{\sqrt {b}}+\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}\right )}{2}+\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b +2 b \left (\tanh \left (x \right )-1\right )+2 \sqrt {a +b}\, \sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{\tanh \left (x \right )-1}\right )}{2}\) \(276\)
default \(-\frac {\sqrt {a +b \tanh \left (x \right )^{2}}\, \tanh \left (x \right )}{2}-\frac {a \ln \left (\sqrt {b}\, \tanh \left (x \right )+\sqrt {a +b \tanh \left (x \right )^{2}}\right )}{2 \sqrt {b}}+\frac {\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{2}-\frac {\sqrt {b}\, \ln \left (\frac {b \left (1+\tanh \left (x \right )\right )-b}{\sqrt {b}}+\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}\right )}{2}-\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b -2 b \left (1+\tanh \left (x \right )\right )+2 \sqrt {a +b}\, \sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{1+\tanh \left (x \right )}\right )}{2}-\frac {\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{2}-\frac {\sqrt {b}\, \ln \left (\frac {b \left (\tanh \left (x \right )-1\right )+b}{\sqrt {b}}+\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}\right )}{2}+\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b +2 b \left (\tanh \left (x \right )-1\right )+2 \sqrt {a +b}\, \sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{\tanh \left (x \right )-1}\right )}{2}\) \(276\)

input
int((a+b*tanh(x)^2)^(1/2)*tanh(x)^2,x,method=_RETURNVERBOSE)
 
output
-1/2*(a+b*tanh(x)^2)^(1/2)*tanh(x)-1/2*a/b^(1/2)*ln(b^(1/2)*tanh(x)+(a+b*t 
anh(x)^2)^(1/2))+1/2*(b*(1+tanh(x))^2-2*b*(1+tanh(x))+a+b)^(1/2)-1/2*b^(1/ 
2)*ln((b*(1+tanh(x))-b)/b^(1/2)+(b*(1+tanh(x))^2-2*b*(1+tanh(x))+a+b)^(1/2 
))-1/2*(a+b)^(1/2)*ln((2*a+2*b-2*b*(1+tanh(x))+2*(a+b)^(1/2)*(b*(1+tanh(x) 
)^2-2*b*(1+tanh(x))+a+b)^(1/2))/(1+tanh(x)))-1/2*(b*(tanh(x)-1)^2+2*b*(tan 
h(x)-1)+a+b)^(1/2)-1/2*b^(1/2)*ln((b*(tanh(x)-1)+b)/b^(1/2)+(b*(tanh(x)-1) 
^2+2*b*(tanh(x)-1)+a+b)^(1/2))+1/2*(a+b)^(1/2)*ln((2*a+2*b+2*b*(tanh(x)-1) 
+2*(a+b)^(1/2)*(b*(tanh(x)-1)^2+2*b*(tanh(x)-1)+a+b)^(1/2))/(tanh(x)-1))
 
3.3.11.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 896 vs. \(2 (67) = 134\).

Time = 0.40 (sec) , antiderivative size = 4825, normalized size of antiderivative = 56.76 \[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=\text {Too large to display} \]

input
integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^2,x, algorithm="fricas")
 
output
[1/4*((b*cosh(x)^4 + 4*b*cosh(x)*sinh(x)^3 + b*sinh(x)^4 + 2*b*cosh(x)^2 + 
 2*(3*b*cosh(x)^2 + b)*sinh(x)^2 + 4*(b*cosh(x)^3 + b*cosh(x))*sinh(x) + b 
)*sqrt(a + b)*log(-((a*b^2 + b^3)*cosh(x)^8 + 8*(a*b^2 + b^3)*cosh(x)*sinh 
(x)^7 + (a*b^2 + b^3)*sinh(x)^8 - 2*(a*b^2 + 2*b^3)*cosh(x)^6 - 2*(a*b^2 + 
 2*b^3 - 14*(a*b^2 + b^3)*cosh(x)^2)*sinh(x)^6 + 4*(14*(a*b^2 + b^3)*cosh( 
x)^3 - 3*(a*b^2 + 2*b^3)*cosh(x))*sinh(x)^5 + (a^3 - a^2*b + 4*a*b^2 + 6*b 
^3)*cosh(x)^4 + (70*(a*b^2 + b^3)*cosh(x)^4 + a^3 - a^2*b + 4*a*b^2 + 6*b^ 
3 - 30*(a*b^2 + 2*b^3)*cosh(x)^2)*sinh(x)^4 + 4*(14*(a*b^2 + b^3)*cosh(x)^ 
5 - 10*(a*b^2 + 2*b^3)*cosh(x)^3 + (a^3 - a^2*b + 4*a*b^2 + 6*b^3)*cosh(x) 
)*sinh(x)^3 + a^3 + 3*a^2*b + 3*a*b^2 + b^3 + 2*(a^3 - 3*a*b^2 - 2*b^3)*co 
sh(x)^2 + 2*(14*(a*b^2 + b^3)*cosh(x)^6 - 15*(a*b^2 + 2*b^3)*cosh(x)^4 + a 
^3 - 3*a*b^2 - 2*b^3 + 3*(a^3 - a^2*b + 4*a*b^2 + 6*b^3)*cosh(x)^2)*sinh(x 
)^2 + sqrt(2)*(b^2*cosh(x)^6 + 6*b^2*cosh(x)*sinh(x)^5 + b^2*sinh(x)^6 - 3 
*b^2*cosh(x)^4 + 3*(5*b^2*cosh(x)^2 - b^2)*sinh(x)^4 + 4*(5*b^2*cosh(x)^3 
- 3*b^2*cosh(x))*sinh(x)^3 - (a^2 - 2*a*b - 3*b^2)*cosh(x)^2 + (15*b^2*cos 
h(x)^4 - 18*b^2*cosh(x)^2 - a^2 + 2*a*b + 3*b^2)*sinh(x)^2 - a^2 - 2*a*b - 
 b^2 + 2*(3*b^2*cosh(x)^5 - 6*b^2*cosh(x)^3 - (a^2 - 2*a*b - 3*b^2)*cosh(x 
))*sinh(x))*sqrt(a + b)*sqrt(((a + b)*cosh(x)^2 + (a + b)*sinh(x)^2 + a - 
b)/(cosh(x)^2 - 2*cosh(x)*sinh(x) + sinh(x)^2)) + 4*(2*(a*b^2 + b^3)*cosh( 
x)^7 - 3*(a*b^2 + 2*b^3)*cosh(x)^5 + (a^3 - a^2*b + 4*a*b^2 + 6*b^3)*co...
 
3.3.11.6 Sympy [F]

\[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=\int \sqrt {a + b \tanh ^{2}{\left (x \right )}} \tanh ^{2}{\left (x \right )}\, dx \]

input
integrate((a+b*tanh(x)**2)**(1/2)*tanh(x)**2,x)
 
output
Integral(sqrt(a + b*tanh(x)**2)*tanh(x)**2, x)
 
3.3.11.7 Maxima [F]

\[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=\int { \sqrt {b \tanh \left (x\right )^{2} + a} \tanh \left (x\right )^{2} \,d x } \]

input
integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^2,x, algorithm="maxima")
 
output
integrate(sqrt(b*tanh(x)^2 + a)*tanh(x)^2, x)
 
3.3.11.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 554 vs. \(2 (67) = 134\).

Time = 0.74 (sec) , antiderivative size = 554, normalized size of antiderivative = 6.52 \[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=-\frac {{\left (a + 2 \, b\right )} \arctan \left (-\frac {\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b} + \sqrt {a + b}}{2 \, \sqrt {-b}}\right )}{\sqrt {-b}} - \frac {1}{2} \, \sqrt {a + b} \log \left ({\left | -{\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )} {\left (a + b\right )} - \sqrt {a + b} {\left (a - b\right )} \right |}\right ) - \frac {1}{2} \, \sqrt {a + b} \log \left ({\left | -\sqrt {a + b} e^{\left (2 \, x\right )} + \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b} + \sqrt {a + b} \right |}\right ) + \frac {1}{2} \, \sqrt {a + b} \log \left ({\left | -\sqrt {a + b} e^{\left (2 \, x\right )} + \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b} - \sqrt {a + b} \right |}\right ) - \frac {2 \, {\left ({\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )}^{3} {\left (a + 2 \, b\right )} + {\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )}^{2} {\left (3 \, a - 2 \, b\right )} \sqrt {a + b} + {\left (3 \, a^{2} - 3 \, a b - 2 \, b^{2}\right )} {\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )} + {\left (a^{2} - a b + 2 \, b^{2}\right )} \sqrt {a + b}\right )}}{{\left ({\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )}^{2} + 2 \, {\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )} \sqrt {a + b} + a - 3 \, b\right )}^{2}} \]

input
integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^2,x, algorithm="giac")
 
output
-(a + 2*b)*arctan(-1/2*(sqrt(a + b)*e^(2*x) - sqrt(a*e^(4*x) + b*e^(4*x) + 
 2*a*e^(2*x) - 2*b*e^(2*x) + a + b) + sqrt(a + b))/sqrt(-b))/sqrt(-b) - 1/ 
2*sqrt(a + b)*log(abs(-(sqrt(a + b)*e^(2*x) - sqrt(a*e^(4*x) + b*e^(4*x) + 
 2*a*e^(2*x) - 2*b*e^(2*x) + a + b))*(a + b) - sqrt(a + b)*(a - b))) - 1/2 
*sqrt(a + b)*log(abs(-sqrt(a + b)*e^(2*x) + sqrt(a*e^(4*x) + b*e^(4*x) + 2 
*a*e^(2*x) - 2*b*e^(2*x) + a + b) + sqrt(a + b))) + 1/2*sqrt(a + b)*log(ab 
s(-sqrt(a + b)*e^(2*x) + sqrt(a*e^(4*x) + b*e^(4*x) + 2*a*e^(2*x) - 2*b*e^ 
(2*x) + a + b) - sqrt(a + b))) - 2*((sqrt(a + b)*e^(2*x) - sqrt(a*e^(4*x) 
+ b*e^(4*x) + 2*a*e^(2*x) - 2*b*e^(2*x) + a + b))^3*(a + 2*b) + (sqrt(a + 
b)*e^(2*x) - sqrt(a*e^(4*x) + b*e^(4*x) + 2*a*e^(2*x) - 2*b*e^(2*x) + a + 
b))^2*(3*a - 2*b)*sqrt(a + b) + (3*a^2 - 3*a*b - 2*b^2)*(sqrt(a + b)*e^(2* 
x) - sqrt(a*e^(4*x) + b*e^(4*x) + 2*a*e^(2*x) - 2*b*e^(2*x) + a + b)) + (a 
^2 - a*b + 2*b^2)*sqrt(a + b))/((sqrt(a + b)*e^(2*x) - sqrt(a*e^(4*x) + b* 
e^(4*x) + 2*a*e^(2*x) - 2*b*e^(2*x) + a + b))^2 + 2*(sqrt(a + b)*e^(2*x) - 
 sqrt(a*e^(4*x) + b*e^(4*x) + 2*a*e^(2*x) - 2*b*e^(2*x) + a + b))*sqrt(a + 
 b) + a - 3*b)^2
 
3.3.11.9 Mupad [F(-1)]

Timed out. \[ \int \tanh ^2(x) \sqrt {a+b \tanh ^2(x)} \, dx=\int {\mathrm {tanh}\left (x\right )}^2\,\sqrt {b\,{\mathrm {tanh}\left (x\right )}^2+a} \,d x \]

input
int(tanh(x)^2*(a + b*tanh(x)^2)^(1/2),x)
 
output
int(tanh(x)^2*(a + b*tanh(x)^2)^(1/2), x)